
package com.probiz.estore.eai.product;

import java.util.List;

import javax.xml.bind.JAXBElement;

import com.probiz.estore.eai.common.GenericMarshaller;
import com.probiz.estore.eai.exception.EaiException;
import com.probiz.estore.eai.product.generated.Body;
import com.probiz.estore.eai.product.generated.Entry;
import com.probiz.estore.eai.product.generated.Header;
import com.probiz.estore.eai.product.generated.Inventory;
import com.probiz.estore.eai.product.generated.InventorySet;
import com.probiz.estore.eai.product.generated.ObjectFactory;


public class InventoryMarshaller extends GenericMarshaller<InventorySet> {
	@Override
	public JAXBElement<InventorySet> populateEntitySetElement()
			throws EaiException {
		ObjectFactory factory = new ObjectFactory();

		InventorySet inventorySet = factory.createInventorySet();
		inventorySet.setRoottag("inventory");
		
		List<Inventory> inventoryList = inventorySet.getInventory();
		
		Inventory inventory = factory.createInventory();
		Header header = factory.createHeader();
		header.setSortCode("0301"); //存货分类
		header.setCode("appleiPod001"); //存货编码
		header.setName("苹果iPod100");//存货名称
		header.setSaunitName("箱");//销售默认计量单位名称
		header.setCcomunitname("车皮");//主计量单位名称
		header.setTaxRate("17");//销项税率
		header.setFRetailPrice("15");//零售价格
		header.setRefSalePrice("12");//参考售价
		header.setCWUnit("千克");//重量单位
		header.setFLength("1000");
		header.setFWidth("500");
		header.setFHeight("300");
		inventory.setHeader(header);
		
		Body body = factory.createBody();
		Entry entry = factory.createEntry();
		body.getEntry().add(entry);
		inventory.setBody(body);
		
		inventoryList.add(inventory);
		

		JAXBElement<InventorySet> inventoryClassDataElement=factory.createUfinterface(inventorySet);
	
		return inventoryClassDataElement;
	}
}
